<template>
	<view class="sub-appeal-content">
		<view class="home-top">
			<view class="home-title">订单详情</view>
			<image src="../../../static/common/sub-back-icon.png" class="sub-back-icon" @tap="backpage"></image>
			<image src="../../../static/common/sbu-home-top-icon.png" class="sub-home-top-icon" @tap="contactKF"></image>
		</view>
		<view class="deatil-bock">
			<view class="title-tex">商品信息</view>
			<view class="goods-info">
				<image src="../../../static/common/img-mask.png" class="img-mask"></image>
				<image :src="taskInfo.imageUrl?getImg(taskInfo.imageUrl) : '../../../static/common/make-order-good-img.png'" class="goods-img"></image>
				<view class="right-block">
					<view style="margin-bottom: 40upx;">店铺名:{{taskInfo.shopName}}</view>
					<view>应拍价:￥{{taskInfo.productActualPrice}}</view>
					<!-- <view>应付:￥{{taskInfo.productActualPrice}}，回填: ￥{{taskInfo.productActualPrice}}，应返: ￥{{calculate(taskInfo.productActualPrice,taskInfo.giftPrice)}}</view> -->
				</view>
			</view>
			<view class="title-tex"  v-if="taskInfo.isTaojinbi || taskInfo.isYouhuiquan || taskInfo.isHuabei">商家要求</view>
			<view class="remark-block"  v-if="taskInfo.isTaojinbi || taskInfo.isYouhuiquan || taskInfo.isHuabei">
				<view class="remark">{{taskInfo.isTaojinbi && taskInfo.isTaojinbi == 1 ? "不要使用淘金币!" : ""}}</view>
				<view class="remark">{{taskInfo.isYouhuiquan && taskInfo.isYouhuiquan == 1 ? "不要使用店铺优惠券!" : ""}}</view>
				<view class="remark">{{taskInfo.isHuabei && taskInfo.isHuabei == 1 ? "不要使用分期、花呗、信用卡!" : ""}}</view>
			</view>
			<view class="title-tex">商家备注</view>
			<view class="remark-block">
				<view class="remark">{{taskInfo.remark?taskInfo.remark:"无额外要求"}}</view>
			</view>
			<view class="title-tex">订单信息</view>
			<view class="order-info">
				<view class="order-text">
					<view class="left-tex"><text>任务编号</text>{{taskId}}</view>
					<image class="copy" src="../../../static/common/copy.png" @tap="makeCopy(1)"></image>
				</view>
				<view class="order-text" v-if="taskInfo.tbOrderId">
					<view class="left-tex"><text>淘宝单号</text>{{taskInfo.tbOrderId}}</view>
					<image class="copy" src="../../../static/common/copy.png" @tap="makeCopy(2)"></image>
				</view>
				<view class="order-text">
					<view class="left-tex"><text>创建时间</text>{{getTime(taskInfo.createTime.time)}}</view>
				</view>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	export default{
		name:"subAppeal",
		data(){
			return{
				orderList:[],
				apptoken:"",
				taskId:"",
				taskInfo:"",
				orderTye:""
			}
		},
		onLoad(options) {
			this.taskId = options.taskId;
			//this.orderTye = options.orderTye;// 1为待审核和已完成 2为已失效
			this.apptoken = uni.getStorageSync("apptoken");
			this.getTaskDetail();
		},
		methods:{
			calculate(productActualPrice,giftPrice){
				return (Number(productActualPrice)*1000 - Number(giftPrice)*1000)/1000;
			},
			getTime(time){
				return this.$CommonJS.getTime(time,1)
			},
			makeCopy(type){
				//复制
				
				const data = type == 1? this.taskId : this.taskInfo.tbOrderId;
				uni.setClipboardData({
				    data:data,
				    success: function () {
				        uni.showToast({
				        	title:"复制成功"
				        })
				    }
				});
			},
			getTaskDetail(){
				//任务详情
				const _this = this;
				uni.request({
					url:this.$API.URL + this.$API.task_view,
					data:{apptoken:this.apptoken,customerTaskId:this.taskId},
					success(res) {
						console.log(res);
						if(res.data.success){
							_this.taskInfo = res.data.data;
						}else{
							_this.$CommonJS.showToast(res.data.msg);
						}
					}
				})
			},
			getImg(img){
				return	this.$CommonJS.getBaseImgUrl(img)
			},
			backpage(){
				this.$CommonJS.navigateBack();
			},
			contactKF(){
				this.$CommonJS.navigateTo('../../subBack/sub-kefu/sub-kefu')
			}
		}
	}
</script>

<style scoped>
	@import url("sub-taskDetail.css");
</style>
